package com.guoguo.api;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.guoguo.base.BaseController;
import com.guoguo.enums.TaskEnum;
import com.guoguo.service.IReplysService;
import com.guoguo.service.IUserExtService;
import com.guoguo.service.IUsersService;
import com.guoguo.service.IVideosService;

/**
 * Created by WYZ on 2017/11/22 0009.
 */
@RestController
@RequestMapping("/api/videos")
public class VideosController extends BaseController {
	
	private final Logger logger = LoggerFactory.getLogger(VideosController.class);

	@Autowired
    private IReplysService iReplysService;

    @Autowired
    private IUserExtService iUserExtService;
    
    @Autowired
    private IUsersService usersService;
    
    @Autowired
    private IVideosService videosService;
    

    /**
     * 视频列表
     * @param model
     * @return
     */
	@ResponseBody
    @RequestMapping(value = "/videosList", method = RequestMethod.POST)
    public JSONObject videosList(HttpServletRequest request, @RequestParam Map<String, String> model){
		logger.info("into VideosController giftCentre method");
		Map<String, Object> data = new HashMap<String, Object>();
		String videoType = model.get("videoType");
		try {
			data = videosService.videosList(videoType);
			return returnResult(TaskEnum.SUCCESS.getId(), data, TaskEnum.SUCCESS.getValue());
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return returnResult(TaskEnum.ERROR.getId(), "false", TaskEnum.ERROR.getValue());
		}
    }



   
}

